/* 
 * File:   UserMessages.h
 * Author: Lance
 *
 * Created on October 1, 2012, 10:54 AM
 */

#ifndef USERMESSAGES_H
#define	USERMESSAGES_H

#include <vector>
#include <map>
#include <string>
#include <semaphore.h>

using namespace std;

struct Message
{
	string subject;
	string message;
};

class UserMessages {
public:
	virtual ~UserMessages();
	static UserMessages* getSingleton();
	vector<Message> getUsersMessages(string user);
	void putUserMessage(string user, Message userMessage);
	bool debug;
private:
	UserMessages();
	UserMessages(const UserMessages& orig);
	static UserMessages * instance;
	sem_t messagesUnlocked;
	map<string, vector<Message> > userMessages;
};

#endif	/* USERMESSAGES_H */

